<link href="admin.css" rel="stylesheet" type="text/css" />
<script src="<{$config.weburl}>/script/jquery-1.4.4.min.js" type="text/javascript" charset="utf-8" ></script>
<script type="text/javascript">
	$(function(){
		/* 全选 */
		 $('.checkall').click(function(){
			var _self = this;
			$('.checkitem').each(function(){
				if (!this.disabled)
				{
					$(this).attr('checked', _self.checked);
				}
			});
			$('.checkall').attr('checked', this.checked);
		});	 
	});
</script>
<div class="container dialog" style="width:94%; margin:auto;">
<form action="" method="get">
<input type="hidden" name="m" value="<{$smarty.get.m}>">
<input type="hidden" name="s" value="<{$smarty.get.s}>">
<input type="hidden" name="id" value="<{$smarty.get.id}>">
<input type="hidden" name="type" value="<{$smarty.get.type}>">
<table class="table select_table" style="margin-bottom:0;">
    <tbody>
    	<tr>
            <td width="70">产品名称:</td>
            <td width="260"><input type="text" name="key" class="w250" value="<{$smarty.get.key}>" /></td>
			<td width="70">产品分类:</td>
            <td>
            <select name="catid">
            	<option value="">选择分类</option>
                <{foreach item=list from=$re}>
                	<option  <{if $smarty.get.catid==$list.catid}>selected="selected"<{/if	}> value="<{$list.catid}>"><{$list.cat}></option>
                <{/foreach}>
            </select>
            </td>
        </tr>
        <tr>    
            <td width="70">产品编号:</td>
            <td width="250"><input type="text" name="code" class="w250" value="<{$smarty.get.code}>" /></td>
            <td colspan="2"><input type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
        </tr>
    </tbody>
</table>
</form>
<form action="" method="post">
<table class="table alc" id="<{$smarty.get.type}>_table">
    <tbody>
        <tr class="header">
            <th width="20"></th>
            <th class="al">产品名称</th>
            <th width="100" class="al">产品编号</th>
            <th width="70">销售价</th>
            <th width="70">市场价</th>
            <th width="70">成本价</th>
            <th width="70">库存</th>
        </tr>
        <{foreach item=list key=num from=$de.list}>
        <tr>
            <td><input type="checkbox" value="<{$list.id}>" class="checkitem" name="chk[]"></td>
            <td class="al td250">
            <input type="hidden" value="<{$list.id}>" name="related_id[]">
            <div class="name" title="<{$list.pname}>"><{$list.pname}></div>
            </td>
            <td class="al"><{$list.code}></td>
            <td><{$list.price}></td>
            <td><{$list.market_price}></td>
            <td><{$list.cost_price}></td>
            <td><{$list.amount}></td>
        </tr>
        <{foreachelse}>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <{/foreach}>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="99">
            	<div class="fl">
                <input type="checkbox" class="checkall" id="del">
                <input type="button" id="save" value="保存" />
                </div>
                <div class="page"><{$de.page}></div>
            </td>
        </tr>
    </tfoot>
</table>
</form>
<script>
$('#save').click(function(){
	var obj=$("input[class='checkitem']:checked");
	if(!obj.length)
	{
		alert("请选择数据，再进行操作!");
		return false;
	}
	window.parent.main.addrow("<{$smarty.get.type}>",0);
	window.parent.DialogManager.close("<{$smarty.get.type}>");
});
</script>
</div>